<script setup>
const props = defineProps({
  items: {
    type: Array,
    default: () => [
      {
        id: 1,
        name: '周杰伦',
        desc: '华语流行乐男歌手'
      },
      {
        id: 2,
        name: '凤凰传奇',
        desc: '中国内地流行演唱组合'
      },
      {
        id: 3,
        name: '张学友',
        desc: '华语流行乐男歌手'
      }
    ]
  }
})
</script>

<template>
  <div class="main_box">
    <h2 class="title">List1</h2>
    <div class="list-data">
      <div class="item_box" v-for="(item, index) in items" :key="index">
        <div class="right">
          <h3 class="rank">{{ item.id }}</h3>
          <h4>{{ item.name }}</h4>
          <div class="text">{{ item.desc }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.main_box {
  width: 100%;
  height: 100%;
  padding: 20px;

  h2 {
    font-size: 1.75em;
    margin-bottom: 20px;
    text-align: center;
  }

  .list-data {
    .item_box {
      position: relative;
      display: flex;
      column-gap: 10px;
      padding: 10px;
      margin-block: 10px;
      overflow: hidden;
      background-color: #fff;
      border-radius: 10px;
      cursor: pointer;
      transition: 0.5s;
      .right {
        display: flex;
        flex-direction: column;
        justify-content: center;
        .rank {
          position: absolute;
          right: -50px;
          color: #27bb9a;
          font-size: 30px;
          transition: right 0.5s;
        }
        h4 {
          font-weight: 600;
          line-height: 1.2em;
        }
        .text {
          font-size: 0.75em;
          line-height: 25px;
        }
      }
    }

    &:hover .item_box {
      filter: blur(6px);
      opacity: 0.4;
    }

    .item_box:hover {
      box-sizing: -10px 20px 35px rgba(0, 0, 0, 0.17);
      transform: scale(1.2);
      filter: blur(0);
      opacity: 1;
      .right .rank {
        right: 20px;
      }
    }
  }
}
</style>
